<script type="text/javascript">
<!--
<?php 
$all = count($dataProvider);
$addresses = $images = $names = $urls = $prices = '';
foreach ($dataProvider as $key => $object) :
	$address		= $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;
	$image			= $object->mainImage ? 
		$this->material_image_src($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id) : 
			$this->material_image_src(0, 'noimage.gif', '205', '');
	$url 			= Yii::app()->createUrl('cataloge/view', array('id'=>$object->id));
	$addresses 		.=  $key+1!=$all ? '"'.$address.'", ' : '"'.$address.'"';
	$images 		.=  $key+1!=$all ? '"'.$image.'", ' : '"'.$image.'"';
	$names 			.=  $key+1!=$all ? '"'.$object->name.'", ' : '"'.$object->name.'"';
	$urls 			.=  $key+1!=$all ? '"'.$url.'", ' : '"'.$url.'"';
	$prices 			.=  $key+1!=$all ? '"'.$object->price.'", ' : '"'.$object->price.'"';
endforeach;
?>
window.addresses = [<?php echo $addresses;?>];
window.images = [<?php echo $images;?>];
window.names = [<?php echo $names;?>];
window.urls = [<?php echo $urls;?>];
window.prices = [<?php echo $prices;?>];
//-->
</script>
<div id="map_canvas" style="width:800px; height:500px; "></div>
<div class="cl list-object">
	<div class="content_holder fl">
		<div class="block_holder br5 greyBg">
			<div class="form_cataloge">
				<form action="<?php echo Yii::app()->createUrl('cataloge/index');?>" method="get">
					<div class="destination_wrap br5">
						<input type="text" name="destination" value="<?php echo Yii::app()->request->getParam('destination');?>" class="destination br5" />
					</div>
					<div class="date_in br5" id="dateIn_home">
						<input type="text" name="check_in" value="<?php echo Yii::app()->request->getParam('check_in');?>" class="home_datePicker"><span></span><i><?php echo Yii::t('main', 'Check in') ?></i>
					</div>
					<div class="date_out br5" id="dateOut_home">
						<input type="text" name="check_out" value="<?php echo Yii::app()->request->getParam('check_out');?>" class="home_datePicker"> <span></span><i>Check out</i>
					</div>
					<div class="select br5 fl">
						<select name="guest" >
							<option>1 Guest</option>
							<option>2 Guests</option>
							<option>3 Guests</option>
							<option>4 Guests</option>
							<option>5 Guests</option>
							<option>6 Guests</option>
							<option>7 Guests</option>
							<option>8 Guests</option>
							<option>9 Guests</option>
							<option>10 Guests</option>
							<option>11 Guests</option>
							<option>12 Guests</option>
							<option>13 Guests</option>
							<option>14 Guests</option>
							<option>15 Guests</option>
							<option>16+ Guests</option>
						</select>
					</div>
					<span class="submit br5">
						<input type="submit" class="btn br5" value="Поиск" />
					</span>
					<a href="#" class="listView">List</a>
					<a href="#" class="photoView">Photo</a>
				</form>
			</div>
		</div>
	</div>
	<div class="content_holder fl">
		<div id="content">
			<div class="block_holder br5 greyBg"><?php echo count($dataProvider);?> results found in <?php echo Yii::app()->request->getParam('destination');?>, for <?php echo Yii::app()->request->getParam('guest');?> guests, from <?php echo Yii::app()->request->getParam('check_in');?> until <?php echo Yii::app()->request->getParam('check_out');?></div>
			<div class="list big">
			<?php foreach ($dataProvider as $key => $object) : ?>
				<div class="object <?php echo ($key+1)%3==0 && $key!=0 ? 'third' : '';?>">
					<div class="object-price"><span><?php echo Yii::t("main", "from")?></span> <?php echo CHtml::encode($object->price); ?> €</div>
					<div class="object-img">
						<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>">
							<?php if($object->mainImage){ ?>
								<?php echo $this->material_image($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id); ?>
							<?php }else{ ?>
								<?php echo $this->material_image(0, 'noimage.gif', '205', ''); ?>
							<?php } ?>
						</a>
					</div>
					<h3 class="object-name">
						<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>" class=""><?php echo CHtml::encode($object->name); ?></a>
					</h3>
					<?php if(isset($object->roomType)):?>
					<p><?php echo CHtml::encode($object->roomType->name); ?></p>
					
					<p class="descr"><?php echo CHtml::encode($object->description); ?></p>
					<?php endif;?>
					<p class="btns">
						<a href="<?php echo Yii::app()->createUrl('cataloge/create',array('id'=>$object->id)); ?>"><span class="btn br3 fl"><?php echo Yii::t('main','Edit') ?></span></a>
						<a href="<?php echo Yii::app()->createUrl('cataloge/view',array('id'=>$object->id)); ?>"><span class="btn br3 fl"><?php echo Yii::t('main','View') ?></span></a>
						<a href="<?php echo Yii::app()->createUrl('users/booking',array('id'=>$object->id)) ?>"><span class="btn br3 fl"><?php echo Yii::t('main','Booking') ?></span></a>
					</p>
					<?php $address = $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;?>
					<a href="#" class="onmap showMap" title="<?php echo $address?>"><?php echo $address?></a>
				</div>
			<?php endforeach; ?>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<!-- Right col -->
	<div id="right" class="br5">
		<div class="order_form">
			<!-- right menu Cabinet -->
			<?php $this->renderPartial('../users/_menu_r_Cabinet'); ?>
		</div>
	</div>
</div>
